home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* Demo of how to get, set, and display contents of various */
- /* TFW communications/terminal devices, sound, etc. */
- /* */
- /* Copyright 1995 deltaComm Development, Inc. */
- /* */
- /****************************************************************/
-
- main()
- {
- int b, p, d, s;
- str ss[30];
-
- printsc(" Baud rate: ");
- gets(ss); // Get a strings from the user
- b=stoi(ss); // and convert it to an integer
- prints(); // before displaying it here
-
- printsc(" Parity: "); // Lather, rinse, repeat for each
- gets(ss); // of the possible comm params.
- p=stoi(ss);
- prints();
-
- printsc(" Data bits: ");
- gets(ss);
- d=stoi(ss);
- prints();
-
- printsc(" Stop bits: ");
- gets(ss);
- s=stoi(ss);
- prints();
-
- set_cparams(b, p, d, s); // Set parameters using user input
-
- s=numconnectdevices(); // Get a count of connect devices
- b=0; // Zero out B for use as temp var.
-
- while (s>b) // While devices still remain...
- { // loop through each and display
- b=b+1; // each one by name.
- printsc("Device #");
- printn(b);
- printsc(" ");
- connectdevicename(b, ss);
- prints(ss);
- }
-
- printsc(" Activate Device: ");
- gets(ss); // Get user input and then set
- set_connectdevice(ss); // connect device according to it
- prints();
-
- printsc("Terminal Emulation:"); // Again, lather, rinse, repeat
- gets(ss); // for terminals, protocols, and
- set_terminal(ss); // others (Translate Tables).
- prints();
-
- printsc(" Default Protocol:");
- gets(ss);
- set_defprot(ss);
- prints();
-
- printsc("Load incoming translation table? (y/n)");
-
- s=inkeyw(); // Wait for an answer to the ???
- toupper(s); // Convert the answer to uppercase
- if (s=="Y") // If the answer is "yes", then
- transtab("", 0); // Load incoming translate table,
- prints(); // prompting for filename w/ ""
-
- printsc("Load outgoing translation table? (y/n)");
- s=inkeyw();
- toupper(s); // Lather, rinse, repeat for
- if (s=="Y") // outbound table. Don't accept
- transtab("", 1); // a shampoo. Demand REAL poo!
- prints();
-
- printsc("Enable sound? <y/n>"); // Finally, allow the user to
- s=inkeyw(); // select sound, keeping in mind
- tolower(s); // that in Cyberspace, EVERYONE
- if (s=='y') // can hear you scream....
- {
- _sound_on=1;
- printsc("Enable alarm? <y/n>");
- s=inkeyw();
- tolower(s);
- if (s=='y') _alarm_on=1;
- else _alarm_on=0;
- }
- else
- _sound_on=0;
-
- }
-